package com.dubbo.consumer;

import dubbo.api.IDubboService;
import dubbo.api.Product;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:RenPu
 * @Date: 2020/11/9 21:43
 * @Version: 1.0
 * @description:
 */

@RestController
public class Controller {


    @Reference(loadbalance = "rterterter")  //此注解是由dubbo单独提供的
    private IDubboService iDubboService;


    @GetMapping("/publish")
    public Product publish(@RequestParam String name) {
        Product product = new Product();
        product.setName(name);
        return iDubboService.publish(product);
    }


}
